import Vue from 'vue'
import Vuex from 'vuex'
import customer from './customer/customer'
import good from './good/good'
import shopInfo from './shopInfo/shopInfo'


Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    // token存储
    token: localStorage.getItem('token') ? localStorage.getItem('token') : '',
  },
  mutations: {
    //存储token
    setToken(state, token) {
      state.token = token;
      localStorage.setItem("token", token);
    },
    //删除token
    delToken(state) {
      state.token = '';
      localStorage.removeItem("token");
    }
  },
  actions: {

  },
  modules: {
    //顾客模块
    customer,
    //商品模块
    good,
    //商家信息模块
    shopInfo
  }

})